import { http } from '@/utils/request'
import type { OperLog, QueryParams } from './type'

const prefix = import.meta.env.VITE_API_SYS

// 查询操作日志列表
export function list(params: QueryParams & Page) {
	return http.get<ResPage<OperLog[]>>(`${prefix}/operlog/list`, params)
}

// 删除操作日志
export function delOperlog(operId: string) {
	return http.delete(`${prefix}/operlog/${operId}`)
}

// 清空操作日志
export function cleanOperlog() {
	return http.delete(`${prefix}/operlog/clean`)
}

// 导出
export function operlogExport(params: QueryParams & Page) {
	return http.postFile<ExportResponse>(`${prefix}/operlog/export`, params, {
		responseType: 'blob',
		headers: {
			'Content-Type': 'application/x-www-form-urlencoded'
		}
	})
}
